import React, { Component } from 'react';
import huiyuan from "./img/ceo.png"
import "./index.scss"
import axios from 'axios'

export default class Ceo extends Component {
    constructor() {
        super();
        this.state = {
            ceoList: [],
            ceoList1: [],
        }
    }
    componentDidMount() {
        axios.post(
            "https://srv.hotkidceo.com/appapi/api/root-ceo-content/ceoPage/pageList",
            { "channelId": null, "memberKey": "", "roleKey": "", "type": 1 }
        ).then(res => {
            console.log(res);
            this.setState({
                ceoList: res.data.data[1].configureAttribute[0].list,
                ceoList1: res.data.data[1].configureAttribute[1].list,
            })
        })
    }
    render() {
        let { ceoList, ceoList1 } = this.state
        return (
            <div className='ceo_con'>
                <div className='ceo_img'><img src={huiyuan} alt={huiyuan} /></div>
                <div className='commodity'>
                    <div className='ceo_title'>免费零食</div>
                    <div className='ceo_sub'>每日领1款，天天0元享</div>
                    <div className='container'>
                        <ul className='container-con container-con1'>
                            {
                                ceoList.map((item, index) => <li key={index} className="con-t">
                                    <img src={item.listImages} alt={item.name} />
                                    <div className='goods-name'>{item.name}</div>
                                    <div className='title_01'>{item.displayName}</div>
                                    <div className='title_02'>￥{item.retailPrice}</div>
                                    <div className='goods-but'>{item.buyCartNum}元领</div>
                                </li>)

                            }

                        </ul>

                    </div>
                    <div className='ceo_sub'>限量供应，购物满99可享</div>
                    <div className='container'>
                        <ul className='container-con'>
                            {
                                ceoList1.map((item, index) => <li key={index} className="con-t">
                                    <img src={item.listImages} alt={item.name} />
                                    <div className='goods-name'>{item.name}</div>
                                    <div className='title_01'>{item.displayName}</div>
                                    <div className='title_02'>￥{item.retailPrice}</div>
                                    <div className='goods-but'>{item.buyCartNum}元领</div>
                                </li>)

                            }

                        </ul>

                    </div>

                </div>
            </div>
        )
    }
}
